#pragma once
#include <iostream>
#include <string>
#include <vector>
#include "Database.h"
#include "MeshRepair.h"
using std::cout;
using std::endl;
class ViewSystem
{
public:
	ViewSystem();
	~ViewSystem();
	//Load file
	bool LoadModel(std::string fileName);
	//Render
	void Render();
	void RenderModel(); //for render to modelPanel
	void RenderBrokenEdges();
	void RenderGroupBrokenEdges(int idx);
	void RenderAllGroupBrokenEdges();
	void RenderGroupOneRing(int idx);

	//Event
	void KeyPress(char keyCode);
	void MouseDown(const char* keyCode,int x,int y);
	void MouseMove(const char* keyCode,int x,int y);

	void CheckBoundaryButton(){m_MeshRepair->CheckBoundary();}
	void CheckGroupButton(){m_MeshRepair->CheckGroup();}
	void CheckGroup2Button(){m_MeshRepair->CheckGroup2();}
	void BoundaryEvent(int idx){m_MeshRepair->BoundaryMapTo2D(idx);}
	void CGAL_DelaunayEvent(double length){m_MeshRepair->CGAL_Delaunay(length);}
	void LeastSquareButton(){m_MeshRepair->LeastSquare();}
	void ClearOtherButton(){m_MeshRepair->ClearOtherBrokenEdge();}
	void CheckMeshHandleButton(){m_MeshRepair->CheckMeshHandle();}
	void CheckNearVertexButton(){m_MeshRepair->CheckNearVertex();}
public:
	Database*	data;
	bool		isRenderWireframe;
private:
	Tri_Mesh* m_Mesh;
	MeshRepair* m_MeshRepair;
};

